/*
n m
a[]

b[]

m=累加c[i-1]*b[i]
c[i]=a[1]*...*a[i] c[0]=1
*/
#include <cstdio>
using namespace std;
#define DEBUG
using ll=long long;
inline int read()
{
    int c=getchar(), f=1, x=0;
    if(c=='-') f*=-1, c=getchar();
    while(c<'0'&&'9'<c) c=getchar();
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    return f*x;
}

inline void write(int x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) write(x/10);
    putchar(x%10+'0');
}

const int N=30, INF=0x3f3f3f3f;
int n, m;
int b[N], c[N];

void init()
{
    n=read(), m=read();
    c[0]=1;
    for(int i=1; i<=n; i++)
        c[i]=c[i-1]*read();
        
}

void solve()
{
    init();
    for(int i=1; i<=n; i++)
    {
        b[i]=(m%c[i]-m%c[i-1])/c[i-1];
    }

    for(int i=1; i<=n; i++)
        write(b[i]), putchar(' ');
    puts("");
}

signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif

    int T=1; //cin >> T; 
    while(T--) 
    {
        solve();
    }
    return 0;
}